package svc

import (
	"github.com/hibiken/asynq"
	asynqx "t-go-zero/common/asynq"
	"t-go-zero/service/asynq/server/internal/config"
)

type ServiceContext struct {
	Config config.Config

	AsynqServer *asynq.Server
	AsynqClient *asynq.Client
}

func NewServiceContext(c config.Config) *ServiceContext {
	return &ServiceContext{
		Config: c,

		AsynqServer: asynqx.NewAsynqServer(c.CacheRedis, c.Concurrency),
		AsynqClient: asynqx.NewAsynqClient(c.CacheRedis),
	}
}
